﻿using Furion;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Gear.NoSql.Core.Redis
{
    public static class RedisClientSettings
    {
        public static readonly object Locker = new object();

        public static ConnectionMultiplexer redisMultiplexer;

        public static IDatabase db = null;
        public static void InitConnect()
        {
            try
            {
                var RedisConnection = App.Configuration["Redis:ConnectionStrings:RedisConnectionString"];
                redisMultiplexer = ConnectionMultiplexer.Connect(RedisConnection);
                db = redisMultiplexer.GetDatabase();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                redisMultiplexer = null;
                db = null;
            }
        }

    }
}
